#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3e5 + 5;
const int MOD = 1e9;

struct Node {
  int pri;
  int val;
  ll sumo, sume;
  int sz;
  int ch[2];
} tr[N];
int tot;
int root;
#define pri(p) tr[p].pri
#define lc(p) tr[p].ch[0]
#define rc(p) tr[p].ch[1]
#define sz(p) tr[p].sz
#define odd(p) tr[p].sumo
#define even(p) tr[p].sume
#define val(p) tr[p].val

void update(int p) {
  sz(p) = 1 + sz(lc(p)) + sz(rc(p));
  int rk = sz(lc(p)) + 1;
  if (rk & 1) {
    odd(p) = val(p) + odd(lc(p)) + even(rc(p));
    even(p) = even(lc(p)) + odd(rc(p));
  } else {
    odd(p) = odd(lc(p)) + odd(rc(p));
    even(p) = val(p) + even(lc(p)) + even(rc(p));
  }
}
void split(int p, int v, int& l, int& r) {
  if (!p) {
    l = 0, r = 0;
    return;
  }
  if (val(p) <= v) {
    l = p;
    split(rc(l), v, rc(l), r);
    update(l);
  } else {
    r = p;
    split(lc(r), v, l, lc(r));
    update(r);
  }
}
int merge(int l, int r) {
  if (!l || !r) return l + r;
  if (pri(l) >= pri(r)) {
    rc(l) = merge(rc(l), r);
    update(l);
    return l;
  } else {
    lc(r) = merge(l, lc(r));
    update(r);
    return r;
  }
}
int newnode(int x) {
  ++tot;
  pri(tot) = rand();
  val(tot) = x;
  odd(tot) = x;
  sz(tot) = 1;
  return tot;
}
void insert(int v) {
  int x, y, z;
  split(root, v, x, z);
  y = newnode(v);
  root = merge(merge(x, y), z);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ll ans = 0;
  int q;
  cin >> q;
  while (q--) {
    int x;
    cin >> x;
    x = (x + ans) % MOD + 1;
    insert(x);
    ans = odd(root);
    cout << ans << endl;
  }
  return 0;
}